<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="./plugs/layui/css/layui.css" media="all">
    <script src="plugs/layui/layui.js"></script>
    <script src="plugs/jq/jquery-3.3.1.min.js"></script>
</head>
<body>
<form>
    <div class="layui-form-item" style="margin:0 auto" id="form">
        <div class="layui-inline">
            <label class="layui-form-label">最近休假日期</label>
            <div class="layui-input-inline">
                <input type="text" name="strHDate" id="strHDate" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
            </div>
        </div>
        <br>
        <div class="layui-inline">
            <label class="layui-form-label">查询日期</label>
            <div class="layui-input-inline">
                <input type="text" name="strDate" id="strDate" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
            </div>
        </div>
        <br>
        <div class="layui-form-item">
            <label class="layui-form-label">休息周期</label>
            <div class="layui-input-block">
                <select name="forDays"  id="forDays" lay-filter="aihao">
                    <option value="2">上1休1</option>
                    <option value="3" selected="true">上2休1</option>
                </select>
            </div>
        </div>
    </div>
</form>
<button style="margin-left: 50px" class="layui-btn" onclick="login()">查询</button>
<br>
<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-header">结果：</div>
        <div class="layui-card-body" id="result">
        </div>
    </div>
</div>
<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#strHDate'
        });
        laydate.render({
            elem: '#strDate'
        });
    });

    function login() {
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "http://122.114.234.76:9999/isWorkDay" ,//url
            data: "strHDate="+$("#strHDate").val()+"&strDate="+$("#strDate").val()+"&forDays="+$("#forDays").val(),
            success: function (result) {
                console.log(result);//打印服务端返回的数据(调试用)
                if (result.code == 1) {
                    $("#result").text(result.data);
                }
            },
            error : function() {
                alert("异常！");
            }
        });
    }
</script>
</body>
</html>